package com.example.communist_app_api.config.mq;

import com.rabbitmq.client.ConnectionFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <h4>community-uniapp</h4>
 * <p></p>
 *
 * @author : Lowell
 * @date : 2023-01-15 20:02
 **/
@Configuration
public class RabbitMQConfig {


    @Value("${spring.rabbitmq.host}")
    public  String HOST;

    @Value("${spring.rabbitmq.port}")
    public  Integer PORT;

    @Value("${spring.rabbitmq.username}")
    public  String USERNAME;

    @Value("${spring.rabbitmq.password}")
    public  String PASSWORD;



    @Bean
    public ConnectionFactory getFactory(){
        ConnectionFactory factory=new ConnectionFactory();
        factory.setHost(HOST);
        factory.setPort(PORT);
        factory.setUsername(USERNAME);
        factory.setPassword(PASSWORD);
        return factory;
    }
}
